﻿/*----------------------------------------------------------------
// Copyright (C) 2011 上海
// 版权所有。 
//
// 文件名：ConyifutypeInfo
// 文件功能描述：洗衣类型维护业务逻辑层
//
// 
// 创建标识：2012-07-13 王冲
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DAO.WaiGaoQiao;

namespace Model.WaiGaoQiao
{
    public class ConyifutypeInfo
    {
        /// <summary>
        /// 主键ID衣服编号
        /// </summary>
        public int Yifu_ID
        {
            get;
            set;
        }
        /// <summary>
        /// 衣服名称
        /// </summary>
        public string Yifumc
        {
            get;
            set;
        }
        /// <summary>
        /// 单价
        /// </summary>
        public decimal Count_xiyi
        {
            get;
            set;
        }

        private DataAccessConyifutype dar;

        public ConyifutypeInfo()
        {
            dar = new DataAccessConyifutype();
        }

        public int GetCount(string strquery)
        {
            return dar.GetCount(strquery);
        }


        public IList<ConyifutypeInfo> GetList(int pagesize, int startindex, string strquery)
        {
            IList<ConyifutypeInfo> yaxlist = new List<ConyifutypeInfo>();
            ConyifutypeInfo yaxinfo;
            DataSet ds = dar.GetList(pagesize, startindex, strquery);
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                yaxinfo = new ConyifutypeInfo()
                {
                    Yifu_ID = Convert.ToInt32(item["Yifu_ID"]),
                    Yifumc = item["Yifumc"].ToString(),
                    Count_xiyi = Convert.ToDecimal(Convert.ToInt32(item["Count_xiyi"]) / 100.00)
                };
                yaxlist.Add(yaxinfo);
            }
            return yaxlist;
        }

        public int DeleteConyifutype(string id)
        {
            return dar.DeleteConyifutype(id);
        }

        public int SaveAdd(ConyifutypeInfo yax)
        {
            object[] yaxpara = new object[] { yax.Yifumc, yax.Count_xiyi };
            return dar.SaveAdd(yaxpara);
        }

        public ConyifutypeInfo GetInfoOne(string id)
        {
            DataSet ds = dar.GetInfoOne(id);
            ConyifutypeInfo info = new ConyifutypeInfo();
            info.Yifu_ID = int.Parse(ds.Tables[0].Rows[0]["Yifu_ID"].ToString());
            info.Yifumc = ds.Tables[0].Rows[0]["Yifumc"].ToString();
            info.Count_xiyi = Convert.ToDecimal(Convert.ToInt32(ds.Tables[0].Rows[0]["Count_xiyi"]) / 100.00);
            return info;
        }

        public int SaveEdit(ConyifutypeInfo yax)
        {
            object[] yaxpara = new object[] { yax.Yifu_ID, yax.Yifumc, yax.Count_xiyi };
            return dar.SaveEdit(yaxpara);
        }
    }
}
